home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / bm_cpio.gz / unixbm.cpio / ndir.h < prev    next >
C/C++ Source or Header  |  1994-07-11  |  1KB  |  50 lines

  1. /*    @(#)ndir.h    1.7    10/7/87    */
  2. #if defined(HP9K5)
  3. /* He should have included it instead of this, but prevent confusion */
  4. #include <ndir.h>
  5. #else /* other */
  6. #ifndef DEV_BSIZE
  7. #define    DEV_BSIZE    512
  8. #endif
  9. #define DIRBLKSIZ    DEV_BSIZE
  10. #define    MAXNAMLEN    255
  11.  
  12. struct    direct {
  13.     long    d_ino;            /* inode number of entry */
  14.     short    d_reclen;        /* length of this record */
  15.     short    d_namlen;        /* length of string in d_name */
  16.     char    d_name[MAXNAMLEN + 1];    /* name must be no longer than this */
  17. };
  18.  
  19. /*
  20.  * The DIRSIZ macro gives the minimum record length which will hold
  21.  * the directory entry.  This requires the amount of space in struct direct
  22.  * without the d_name field, plus enough space for the name with a terminating
  23.  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  24.  */
  25.  
  26. #ifdef DIRSIZ
  27. #undef DIRSIZ
  28. #endif /* DIRSIZ */
  29. #define DIRSIZ(dp) \
  30.     ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
  31.  
  32. /*
  33.  * Definitions for library routines operating on directories.
  34.  */
  35. typedef struct _dirdesc {
  36.     int    dd_fd;
  37.     long    dd_loc;
  38.     long    dd_size;
  39.     char    dd_buf[DIRBLKSIZ];
  40. } DIR;
  41. #ifndef NULL
  42. #define NULL 0
  43. #endif
  44. extern    DIR *opendir();
  45. extern    struct direct *readdir();
  46. extern    void closedir();
  47.  
  48. #define rewinddir(dirp)    seekdir((dirp), (long)0)
  49. #endif /* other */
  50.